import { entriesAllDepartment, entriesAllRoles } from '@/service/main/main'
import type { IMainStore } from '@/types/main_user'
import { defineStore } from 'pinia'

export const useEntriesDataStore = defineStore('entries', {
  state: (): IMainStore => ({
    allRoles: [],
    allDepartments: []
  }),
  actions: {
    async getEntriesDataAction() {
      const rolesResult = await entriesAllRoles()
      const departmentsResult = await entriesAllDepartment()
      // console.log('rolesResult:', rolesResult)
      // console.log('departmentsResult:', departmentsResult)
      this.allRoles = rolesResult.data.list
      this.allDepartments = departmentsResult.data.list
    }
  }
})
